package com.jp.knowledge.logic;

import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;

/**
 * Created by jiayen on 17/4/6.
 */

public class PermissionLogic {

    /**
     * 检查权限
     * @param permission
     * @return
     */
    private static boolean checkPermission(Context mContext,String permission){
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            return ContextCompat.checkSelfPermission(mContext, permission) ==
                    PackageManager.PERMISSION_DENIED;
        }
        return  false;
    }

    /***
     * 请求权限
     */
    private static void requesPermission(Activity activity,int resutlCode, String[] permission){
        ActivityCompat.requestPermissions(activity,permission,resutlCode);
    }
}
